package com.itany.corejava.code07_常用类.zuoye;

/**
 * @author MissChen
 * @date 2024年03月02日 16:55
 */

/**
 * 定义一个Bank类，是一个泛型类
 * 属性有bankName银行名称、time存款时间、username用户名、cardNum卡号
 * 这些属性的类型都是同一个未知的类型
 * money存款金额、balance账户余额属于double类型
 * 定义Bank实例，自行测试
 */
public class Test3 {
    public static void main(String[] args) {
        Bank<String> bank=new Bank<>("中国银行","2024-03-08","孙华华","123456789",8000,9000);
        System.out.println(bank);
    }
}
class Bank<T>{
    T bankName;
    T time;
    T username;
    T cardNum;
    double money;
    double balance;

    public Bank(T bankName, T time, T username, T cardNum, double money, double balance) {
        this.bankName = bankName;
        this.time = time;
        this.username = username;
        this.cardNum = cardNum;
        this.money = money;
        this.balance = balance;
    }

    public T getBankName() {
        return bankName;
    }

    public void setBankName(T bankName) {
        this.bankName = bankName;
    }

    public T getTime() {
        return time;
    }

    public void setTime(T time) {
        this.time = time;
    }

    public T getUsername() {
        return username;
    }

    public void setUsername(T username) {
        this.username = username;
    }

    public T getCardNum() {
        return cardNum;
    }

    public void setCardNum(T cardNum) {
        this.cardNum = cardNum;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    @Override
    public String toString() {
        return "Bank{" +
                "bankName=" + bankName +
                ", time=" + time +
                ", username=" + username +
                ", cardNum=" + cardNum +
                ", money=" + money +
                ", balance=" + balance +
                '}';
    }
}